package com.gem.day12.homework;

import java.util.*;

public class Exercise1 {
	public static void main(String[] args) {
		Map<Integer, String> map = new HashMap<>();
		map.put(1930, "乌拉圭");
		map.put(1934, "意大利");
		//...
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入一个年份: ");
		int year = scanner.nextInt();
		if (map.containsKey(year)) {
			System.out.println(year + "年获得世界杯冠军的国家是: " + map.get(year));
		} else {
			System.out.println(year + "年没有举办世界杯!");
		}

		System.out.println("请您输入一个国家: ");
		String contry = scanner.next();
		if (map.containsValue(contry)) {
			for (Integer y : map.keySet()) {
				if (map.get(y).equals(contry)) {
					System.out.println(y + "\t");
				}
			}
		} else {
			System.out.println("该国家没有获得过世界杯冠军!");
		}
		scanner.close();
	}
}
